package api

import (
	"github.com/gin-gonic/gin"
	"zg3/live-broadcasts/api/handler"
	"zg3/live-broadcasts/pkg"
)

func LoadRouter(r *gin.Engine) {

	api := r.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("/login", handler.UserLogin)
			user.Use(pkg.JWTAuth("2210a"))
			user.POST("/enter", handler.EnterLive)
		}
		live := api.Group("/live")
		{
			live.Use(pkg.JWTAuth("2210a"))
			live.POST("/create", handler.CreateLive)
		}
		administrators := api.Group("/administrators")
		{
			administrators.GET("/liveList", handler.LiveList)
			administrators.GET("/liveUser", handler.LiveUser)
			administrators.GET("/liveness", handler.LiveLiveness)

			administrators.POST("/kills", handler.KillsLive)
		}
	}

}
